package com.binvshe.binvshe.app.home;

import android.graphics.Color;
import android.os.Build;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.Window;
import android.view.WindowManager;


import com.binvshe.binvshe.R;
import com.pachong.android.baseuicomponent.activity.BaseActivity;
import com.pachong.android.frameworkbase.customviews.multiviewpager.MultiViewPager;

import butterknife.Bind;
import butterknife.ButterKnife;

public class GuideActivity extends BaseActivity {

    @Bind(R.id.mvpGuide)
    MultiViewPager mvpGuide;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        ButterKnife.bind(this);
        hideToolbar();
        mvpGuide.setFragmentManager(getSupportFragmentManager());
        initGuideFragment();

        if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
            Window window = getWindow();
            window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS
                    | WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION);
            window.getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
                    | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
                    | View.SYSTEM_UI_FLAG_LAYOUT_STABLE);
            window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
            window.setStatusBarColor(Color.TRANSPARENT);
//            window.setNavigationBarColor(Color.TRANSPARENT);
        }

    }

    @Override
    public View createDataView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        return inflater.inflate(R.layout.act_guide, null);
    }

    private void initGuideFragment() {
        GuideOneFragment guideOneFragment = new GuideOneFragment();
        GuideTwoFragment guideTwoFragment = new GuideTwoFragment();
        GuideThreeFragment guideThreeFragment = new GuideThreeFragment();
        Fragment[] fragments = new Fragment[]{guideOneFragment, guideTwoFragment, guideThreeFragment};
        for (int i = 0; i < fragments.length; i++) {
            mvpGuide.add(fragments[i]);
        }
    }

}
